<?php
include_once("../TeamDao.php");
include_once("../../user.php");
include_once("../UserDao.php");

//create captain
$captain = new user("Clooney", "George", 12344321, "batman");
echo "created captain. \n";
//create dao
$user_dao = new UserDao();
$user_dao->insert($captain,"");
//create team
$testTeam = new Activity(314, "The Incredibles", "Football", $captain);
echo "created team. \n";
//create dao
$team_dao = new TeamDao();
echo "created dao. \n";
//put into db
$team_dao->insert($testTeam);
echo "inserted team. id = ".$testTeam->getId()."\n";

//create team member
$teammate = new user("Guy", "Some", 88881234, "robin");
echo "created teammate. \n";
//insert via dao
$user_dao->insert($teammate,"");
echo "inserted teammate: ";
$teammate_id = $user_dao->lookupUwIdForUserName("robin");
echo $teammate_id."\n";
//add member into team
$team_dao->addTeammateByUwId($testTeam, $teammate_id,0);
echo "mapped teammate to team\n";
//team member list:
echo "team member list:\n";
$members = $team_dao->lookupMembers($testTeam->getId());
for( $ix = 0; $ix < count($members); ++$ix ) {
	echo $ix.": ";
	echo $members[$ix]."\n";
}
//verify reconstruction of team on fetch
$team_fetched = $team_dao->lookupTeam($testTeam->getId());
echo "team name: ";
echo $team_fetched->getName();
echo "\n";

?>
